<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.AddressListModule.bean.*,util.*,com.AddressListModule.dao.*"%>  
<%
	//---------分页
	int currentPage=1;
	if(request.getParameter("Page")!=null)
	{
		currentPage=Integer.parseInt(request.getParameter("Page"));
	}
	String linkName = session.getAttribute("linkName").toString();
	String phone = session.getAttribute("phone").toString();
	List<ContactBean> mmsList = (ArrayList) session 
			.getAttribute("contactList");
	int colSpanNum = 8;
%>
<jsp:include page="../head.jsp"></jsp:include>
<%
	String result = session.getAttribute("resultAdd").toString();
	if(!result.equals("")){
		out.println("<script>alert('"+result+"');</script>");
		session.removeAttribute("resultAdd");
	}
%>
 <body>
  <div id="pager">
  <jsp:include page="../top.jsp"><jsp:param name="topCurrent" value="4" /></jsp:include>
  <jsp:include page="Left.jsp"> <jsp:param name="um" value="12" /></jsp:include> 
		<section id="container">
		 <div id="crumbs">
        	客户管理 &raquo; 内部联系人
        </div>
		<div id="main">
			<div class="tabs">
				<ul class="tabs-nav clearfix">
					<li>
						内部联系人
					</li>
				</ul>
				<div class="tabs-panel">
					<table width="100%" class="datalist">
						<thead>
							<tr>
								<th colspan="9" class="tl">
												联系人
												 <input type="text" name="linkName" id="linkName" value="<%=linkName %>">
												手机号码：
												<input type="text" name="phone" id="phone" value="<%=phone %>">
												<input type="button" value="查询" onclick="searchContact('../AddressServlet?method=searchContact')">&nbsp;&nbsp;
												<input type="button" value="批删" onclick="deleteAllContact('../AddressServlet?method=deleteAllContact&linkName=<%=linkName %>&phone=<%=phone %>')">
								</th>

							</tr>
							<tr>
								<td width="30" class="tc">
									<input type="checkbox" title="全选"
										onClick="check_allT('deleteAll')"/>
								</td>
								<td>
									联系人
								</td>
								<td>
									手机号码
								</td>
								<td>
									所属群组
								</td>
								<td>
									最后时间
								</td>
								<td>
									操作
								</td>
							</tr>
						</thead>
						<%
							if (mmsList != null && mmsList.size() > 0) {
								 MyPagination mPage=new MyPagination();
								 mmsList=mPage.getInitPage(mmsList,currentPage,10);
								 AddressModuleDao addressModuleDao = new AddressModuleDao();
								for (ContactBean mmsSendBean : mmsList) {
						%>
						<tr>
							<td class="tc">
								<input name="deleteAll" id = "deleteAll" type="checkbox" value="<%=mmsSendBean.getCustomerId() %>"/>
							</td>
							<td><%=mmsSendBean.getCustomerName()%></td>
							<td><%=mmsSendBean.getCustomerPhone()%></td>
							<td><%=addressModuleDao.getDirect(mmsSendBean.getDirId()).getDirName()%></td>
							<td><%=Constant.nullToString(mmsSendBean.getLastTime())%></td>
							<td class="tc">
							<a class="duanyu_edit" onclick="$mb=$.msgbox({height:320,width:550,content:{type:'ajax',content:'AddressServlet?method=modifyContact&mmsId=<%=mmsSendBean.getCustomerId() %>'},title: '联系人',onAjaxed: function(data){}});">修改</a>
								<a title="删除" class="duanyu_del"style="cursor:hand" onClick="deleteOneContact('../AddressServlet?method=deleteContact&mmsId=<%=mmsSendBean.getCustomerId() %>&linkName=<%=linkName %>&phone=<%=phone %>')">删除</a>
							</td>
						</tr>
						<%
							}
								%>
								 <tr>
		     	   					<td colspan="<%=colSpanNum %>"  class="tc" >
		     	   					<%=mPage.printCtrl("AddressServlet",currentPage,"&method=lookContact&linkName="+linkName+"&phone="+phone) %>
		     	   					</td>
	     	                      </tr>
									<%
							}
						%>
					</table>
				</div>

			</div>
		</div>
		</section>
		  <jsp:include page="../foot.jsp"></jsp:include>
		</div>
	</body>
</html>
